enum dtype_data_define {
	TYPE(DATA_DEFINE)=0x3220,
	TYPE(EVENT_DEFINE)=0x3230
};
enum subtype_data_define {
	SUBTYPE(DATA_DEFINE,ENV_DATA)=0x1,
	SUBTYPE(DATA_DEFINE,DOWNLOAD_REQ),
	SUBTYPE(DATA_DEFINE,DATA_UNIT),
	SUBTYPE(DATA_DEFINE,DATA_VIEW)
};
enum subtype_event_define {
	SUBTYPE(EVENT_DEFINE,EVENT_REPORT)=0x1,
	SUBTYPE(EVENT_DEFINE,EVENT_NOTICE),
	SUBTYPE(EVENT_DEFINE,EVENT_ANALYSIS),
	SUBTYPE(EVENT_DEFINE,EVENT_CONTROL)
};

enum enum_data_state
{
	DATA_NORMAL=0x01,
    DATA_NEEDCHECK,
    DATA_ALARM,
    DATA_DEALED,
    DATA_NOTCHECK
};

enum enum_event_state
{
	EVENT_CONTROL=0x01,
    EVENT_ALARM,
    EVENT_NOTICE,
    EVENT_PROCESS,
    EVENT_STOP
};

enum enum_ctrl_cmd
{
	CTRL_START=0x01,
    CTRL_HALT,
    CTRL_CONFIG,
    CTRL_ADDUSER,
    CTRL_DELUSER
};

typedef struct data_define_envdata{
	char *node_name;
	int start_time;
	int interval;
	int data_num;
	BYTE data_uuid[32];
}__attribute__((packed)) RECORD(DATA_DEFINE,ENV_DATA);

typedef struct data_define_download_req{
	char * user;
	char * node_name;
	int start_time;
	int data_num;
}__attribute__((packed)) RECORD(DATA_DEFINE,DOWNLOAD_REQ);

typedef struct data_define_dataview{
	char * node_name;
    int start_time;
    int interval;
    int data_num;
	void * data_array;
}__attribute__((packed)) RECORD(DATA_DEFINE,DATA_VIEW);

typedef struct data_define_dataunit{
	int serial_no;
	int value;
}__attribute__((packed)) RECORD(DATA_DEFINE,DATA_UNIT);

typedef struct event_define_event_report{
	char * node_name;
	int start_time;
	int end_time;
	enum enum_data_state data_state;
}__attribute__((packed)) RECORD(EVENT_DEFINE,EVENT_REPORT);

typedef struct event_define_event_notice{
	char * node_name;
	BYTE event_uuid[32];
	int gettime;
	char * manager;
}__attribute__((packed)) RECORD(EVENT_DEFINE,EVENT_NOTICE);

typedef struct event_define_event_analysis{
	char * reporter;
	char * node_name;
	int start_time;
	int end_time;
	enum enum_data_state data_state;
	char * analysis_info;
}__attribute__((packed)) RECORD(EVENT_DEFINE,EVENT_ANALYSIS);

typedef struct event_define_control{
	char * controller;
	char * node_name;
	enum enum_ctrl_cmd command;
	int start_time;
}__attribute__((packed)) RECORD(EVENT_DEFINE,EVENT_CONTROL);
